﻿using System;

using Microsoft.Phone.Controls;

namespace NavigationCoercion.Actions
{
    internal class RedirectAction : RedirectActionBase
    {
        private readonly string _page;

        public RedirectAction(Type pageType)
        {
            this._page = pageType.GetPossibleXamlPagePath();
        }

        internal override void PerformRedirect(PhoneApplicationFrame frame)
        {
            frame.Dispatcher.BeginInvoke(() => frame.Navigate(new Uri(this._page, UriKind.Relative)));
        }
    }
}